/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package org.opensudoku.root.solver;

import org.opensudoku.root.concrete.ConcreteResults;
import org.opensudoku.root.exceptions.InvalidDimensionException;
import org.opensudoku.root.exceptions.SetLengthExceededException;
import org.opensudoku.root.exceptions.UnIntializedParameterException;
import org.opensudoku.root.fon.FonResults;
import org.opensudoku.root.vsb.VirtualSudokuBoard;

/**
 *
 * @author sony
 */
public class V2S_Results {
    private ConcreteResults V2S_CR;

    public V2S_Results(ConcreteResults cr)
    {
        this.V2S_CR=cr;
    }
    public V2S_Results()
    {
        this.V2S_CR=null;
    }
    public boolean V2S_CheckAll() throws UnIntializedParameterException, SetLengthExceededException, InvalidDimensionException
    {
        if(this.V2S_CR==null)
            throw new UnIntializedParameterException("\'V2S_Results.V2S_CR\'");
        for(int i=0;i<this.V2S_CR.getNoOfSolutions();i++)
            if(!this.V2S_CR.ReturnSolutionAt(i).CheckMe()||!this.V2S_CR.ReturnSolutionAt(i).CheckFull())
                return false;
        return true;
    }
    public ConcreteResults V2S_ReturnCRReference()
    {
        return this.V2S_CR;
    }
    public FonResults V2S_ReturnFonReference()
    {
        return this.V2S_CR.ReturnFonReference();
    }
    public int V2S_totalNoOfSolutions()
    {
        return this.V2S_CR.getNoOfSolutions();
    }
    public VirtualSudokuBoard V2S_TestAndReturnSolutionAt(int index) throws SetLengthExceededException, UnIntializedParameterException, InvalidDimensionException
    {
        if(this.V2S_CR.ReturnSolutionAt(index).CheckMe()&&this.V2S_CR.ReturnSolutionAt(index).CheckFull())
            return this.V2S_CR.ReturnSolutionAt(index);
        return null;
    }
    public void V2S_PrintSolutionAt(int index) throws SetLengthExceededException
    {
        this.V2S_CR.ReturnSolutionAt(index).printBoard();
    }
    public VirtualSudokuBoard V2S_ReturnSolutionAt(int index) throws SetLengthExceededException
    {
        return this.V2S_CR.ReturnSolutionAt(index);
    }
    public boolean V2S_isConcreteApplied()
    {
        return !this.V2S_CR.ReturnFonReference().ConcreteFlag;
    }
}
